POV-Ray : Newsgroups : povray.general : Trce in superpatch : Trce in superpatch Server Time
12 Aug 2024 01:34:07 EDT (-0400)
  Trce in superpatch  
From: Mick Hazelgrove
Date: 6 Apr 1999 14:04:02
Message: <370a3e82.0@news.povray.org>
Hi All

when I run the following code not only do I get 100 spheres but as the code
loops it also draws the slab a hundred times or so.
Can anyone suggest a way of using trace in a way that the object is only
drawn once? Otherwise the memory hit with high samples is horrendous!

Mick

===================================================

#version 3.1;//Superpatch

#include "colors.inc"

// ----------------------------------------
camera
{
  location  <0.0, 10, -20.0>
  direction 1.5*z
  right     4/3*x
  look_at   <0.0, 0.0,  0.0>
}

sky_sphere
{
  pigment
  {
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

light_source{<-30, 30, -30>,color rgb<1,1,1>}

// ----------------------------------------

#declare Step2 = box{<-2, 0, -2>< 2,  .4,  2> pigment{Yellow}}

#declare Norm = <0,0,0>;
#declare Xpos = -5;
#declare Zpos = 5;


#while (Xpos<6)

   #while (Zpos>-6)

        #declare SPos = <Xpos,1,Zpos>;

        #declare Inter = trace (Step2,SPos,<0,0,0>-SPos, Norm );

                object{Step2 texture {pigment{color rgb<1,1,0>}}}
                        #if (Norm.x != 0 | Norm.y != 0 | Norm.z != 0)
                                sphere{Inter,.1 texture{pigment{color red
1}}}
                        #end
    #declare Zpos = Zpos -1;
    #end
    #declare Zpos = 5;
  #declare Xpos = Xpos +1;

#end


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.